package com.qinglei.recoup.system.service.impl;

import com.qinglei.recoup.common.exception.RedisConnectException;
import com.qinglei.recoup.common.service.RedisService;
import com.qinglei.recoup.common.utils.JsonUtils;
import com.qinglei.recoup.system.domain.HealthBigData;
import com.qinglei.recoup.system.domain.RealTimeMonitoring;
import com.qinglei.recoup.system.dao.RealTimeMonitoringMapper;
import com.qinglei.recoup.system.service.RealTimeMonitoringService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author dqh
 */
@Service
public class RealTimeMonitoringServiceImpl extends ServiceImpl<RealTimeMonitoringMapper, RealTimeMonitoring> implements RealTimeMonitoringService {

    @Resource
    private RedisService redisService;

    public List<RealTimeMonitoring> getRealTimeMonitoring(String key) throws RedisConnectException {
        String s = redisService.get(key);
        List<RealTimeMonitoring> realTimeMonitoring = JsonUtils.jsonToList(s, RealTimeMonitoring.class);
        return realTimeMonitoring;
    }
}
